package com.yanyu.space.common.db.config;

import com.yanyu.space.common.db.pagination.PageInterceptor;
import lombok.AllArgsConstructor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;

/**
 * @author yanyu
 */
@AllArgsConstructor
public class PageInterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new PageInterceptor()).addPathPatterns("/**").excludePathPatterns(
                Arrays.asList("/**/*.js", "/**/*.png", "/**/*.css", "/**/*.html", "/favicon.ico",
                        "/swagger/**", "/api-docs/**", "/actuator/**"));
    }
}
